package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.entity.lindi.vo.tradeapplicationoperator.LindiTradeApplicationOperatorVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiTradeApplicationOperatorFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiTradeApplicationOperatorFeignClient"
        , path = "/minimalist/lindi/tradeApplicationOperator"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiTradeApplicationOperatorFeignClientFallbackFactory.class)
public interface LindiTradeApplicationOperatorFeignClient{

    /**
     * 交易申请操作
     *
     * @param operatorVO 交易申请操作
     * @return R
     */
    @PostMapping("/addTradeApplicationOperator")
    @Operation(summary = "添加交易申请操作")
    R<?> addTradeApplicationOperator(
            @RequestBody @Validated(Add.class)
            LindiTradeApplicationOperatorVO operatorVO);

    /**
     * 删除交易申请操作 -> 根据操作ID删除
     *
     * @param tradeApplicationOperatorId 操作ID
     * @return R
     */
    @DeleteMapping("/deleteTradeApplicationOperatorById")
    @Operation(summary = "删除交易申请操作 -> 根据操作ID删除")
    R<?> deleteTradeApplicationOperatorByTradeApplicationOperatorId(
            @RequestParam("tradeApplicationOperatorId")
            @NotNull(message = "交易申请操作ID不能为空")
            @Parameter(name = "tradeApplicationOperatorId", required = true, description = "交易申请操作ID")
            Long tradeApplicationOperatorId);

    /**
     * 修改交易申请操作
     *
     * @param operatorVO 交易申请操作
     * @return R
     */
    @PutMapping("/updateTradeApplicationOperator")
    @Operation(summary = "修改交易申请操作")
    R<?> updateTradeApplicationOperatorByTradeApplicationOperatorId(
            @RequestBody @Validated(Update.class)
            LindiTradeApplicationOperatorVO operatorVO);

    /**
     * 根据交易申请ID查询操作记录
     *
     * @param tradeApplicationId 交易申请ID
     * @return R
     */
    @GetMapping("/getTradeApplicationOperatorsByTradeApplicationId/{tradeApplicationId}")
    @Operation(summary = "根据交易申请ID查询操作记录")
    R<List<LindiTradeApplicationOperatorVO>>
    getTradeApplicationOperatorsByTradeApplicationId(
            @PathVariable(value = "tradeApplicationId")
            @NotNull(message = "交易申请ID不能为空")
            @Parameter(name = "tradeApplicationId", description = "交易申请ID", required = true)
            Long tradeApplicationId);
}
